/*
 * @Description: 
 * @Author: mmzhang
 * @Date: 2023-01-06 17:10:24
 * @LastEditTime: 2023-01-10 15:52:43
 */
import dateOpt from '@/biz/option/date.js'
import table from '@/components/dt/table/render.js'

function options(_this) {
  return [
    {
      field: 'articleTitle',
      title: '文章标题',
      minWidth: 100,
      slots: {
        default: (params, h) => {
          if (_this.tabName != 0) {
            return table.cell.btn(_this, h, {
              title: params.row.articleTitle,
              event: 'labelTypeClick',
              data: params.row
            })
          } else {
            return table.cell.text(h, {
              value: params.row.articleTitle,
            })
          }
        }
      },
    },
    {
      field: 'housesName',
      title: '所属楼盘',
      minWidth: 150,
      header: {
        filter: {
          key: 'housesName',
          title: '所属楼盘',
          input: {},
          placeholder: '请输入楼盘'
        }
      }
    },
    {
      field: 'city',
      title: '所属城市',
      minWidth: 150,
    },
    {
      field: 'createTime',
      title: '创建时间',
      minWidth: 120,
      header: {
        filter: dateOpt.range({
          title: '创建时间',
          startKey: 'submitTimeStartDate',
          endKey: 'submitTimeEndDate'
        })
      },
    },
    {
      field: 'createName',
      title: '创建人',
      minWidth: 140,
    },
    {
      field: 'handles',
      title: '操作',
      minWidth: 150,
      fixed: 'right',
      slots: {
        default: (params, h) => {
          let btns = []

          btns.push({
            title:  '流程信息',
            event: 'processFun',
            data: params.row
          })

          btns.push({
            title: _this.unlocking('0206030100') && _this.tabName == '0' ? '审核' : '',
            event: 'reviewFun',
            data: params.row
          })

          btns.push({
            title: _this.tabName == '2' ? '查看驳回原因' : '',
            event:  'viewReason',
            data: params.row
          })

          return table.cell.btns(_this, h, btns)
        }
      }
    }
  ]
}

export default {
  options
}